<?php

include_once 'smartmysqlbase.php';
$db = new SmartMySQLBase('localhost', 'root', 'asdf', 'phpmyadmin');

//Configuration
$db->persistant = true; // Persistant connection (pconnect)
$db->fetchMode = MYSQL_BOTH; // Set the MySQL fetch mode, default is MYSQL_ASSOC 

//Cache
$db->cache = true; // Turn global cache on
$db->cacheFolder = 'temp/mysql_cache/'; // Set directory where cached files will be saved, default is 'cache/'
$db->cacheExpire = (60 * 15); // Set global cache expiration time to 15 minutes
$db->cacheTimezone = 'Asia/Tbilisi'; // Set server timezone for calculating expiration time securly, default is 'Europe/London'


echo $db->lastQuery; // Prints last executed query


//SmartMySQLBase::execute($query);
$db->execute("SELECT * FROM `pma_history` WHERE `id` = 5;"); // Executes query


//SmartMySQLBase::fetch($query, $cache = 0);
$sql = "SELECT * FROM `pma_history` WHERE `id` = 5;";

$data = $db->fetch($sql); // Returns associative array
$data = $db->fetch($sql, 300); // Cache for 5 minutes(60 * 5 = 300), ignores global caching
$data = $db->fetch($sql, false); // Do not cache while global caching is activated


//SmartMySQLBase::fetchAll($query, $cache = 0);
$sql = "SELECT * FROM `pma_history`;";

$data = $db->fetchAll($sql); // Returns multi-level associative array
$data = $db->fetchAll($sql, 300); // Cache for 5 minutes (60 * 5 = 300), ignores global caching
$data = $db->fetchAll($sql, false); // Do not cache while global caching is activated





?>